import { parse } from 'querystring';

export const getPageQuery = () => parse(window.location.href.split('?')[1]);

export const isMenuVisible = (MENUID: string) => {
    // console.log(JSON.parse(localStorage.getItem('MenuPower')));
    let visible = false;
    // console.log(localStorage.getItem('MenuPower'));
    if(localStorage.getItem('MenuPower') !== 'undefined'){
        // console.log(localStorage.getItem('MenuPower'));
        (JSON.parse(localStorage.getItem('MenuPower')) || []).forEach((e: any) => {
            if(e.perms === MENUID) visible = true;
        })
    }
    return visible;
    // const menuArr = JSON.parse(localStorage.getItem('MenuPower')) || [];
    // const mlen = menuArr.length;
    // for(let i = 0; i < mlen - 1; i++){
    //     console.log(i)
    //     if(MENUID === menuArr[i].menuId) return true;
    //     return false;
    // }
}
